package io.kiki.sba.registry.common.model;


import com.google.common.collect.Sets;
import io.kiki.sba.registry.common.model.constants.ValueConstants;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;

public class InterestGroup {

    private static final Set<String> interestGroups = Sets.newConcurrentHashSet(new ArrayList<>(Arrays.asList(ValueConstants.DEFAULT_GROUP)));

    public static void registerInterestGroup(String... groups) {
        interestGroups.addAll(Arrays.asList(groups));
    }

    public static String normalizeGroup(String group) {
        if (group != null && interestGroups.contains(group)) {
            return group;
        }
        return "other";
    }
}
